<?php

/**
 * This is the model class for table "d_peg".
 *
 * The followings are the available columns in table 'd_peg':
 * @property integer $ID
 * @property string $NIP
 * @property string $NAMA
 * @property string $TGLAHIR
 * @property string $SEX
 * @property string $STAPEG
 * @property string $KDUNIT
 * @property string $KDDEPT
 * @property string $KDDEPT1
 * @property string $GOL
 * @property string $TMTGOL
 * @property integer $MKGTH
 * @property integer $MKGBL
 * @property integer $ISTRI
 * @property integer $ANAK
 * @property string $KDDIDIK
 * @property string $ESE
 */
class DPeg extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return DPeg the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'd_peg';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('MKGTH, MKGBL, ISTRI, ANAK', 'numerical', 'integerOnly'=>true),
			array('NIP', 'length', 'max'=>18),
			array('NAMA', 'length', 'max'=>35),
			array('SEX, STAPEG', 'length', 'max'=>1),
			array('KDUNIT', 'length', 'max'=>10),
			array('KDDEPT', 'length', 'max'=>4),
			array('KDDEPT1', 'length', 'max'=>3),
			array('GOL, KDDIDIK, ESE', 'length', 'max'=>2),
			array('TGLAHIR, TMTGOL', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('ID, NIP, NAMA, TGLAHIR, SEX, STAPEG, KDUNIT, KDDEPT, KDDEPT1, GOL, TMTGOL, MKGTH, MKGBL, ISTRI, ANAK, KDDIDIK, ESE', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'ID' => 'ID',
			'NIP' => 'Nip',
			'NAMA' => 'Nama',
			'TGLAHIR' => 'Tglahir',
			'SEX' => 'Sex',
			'STAPEG' => 'Stapeg',
			'KDUNIT' => 'Kdunit',
			'KDDEPT' => 'Kddept',
			'KDDEPT1' => 'Kddept1',
			'GOL' => 'Gol',
			'TMTGOL' => 'Tmtgol',
			'MKGTH' => 'Mkgth',
			'MKGBL' => 'Mkgbl',
			'ISTRI' => 'Istri',
			'ANAK' => 'Anak',
			'KDDIDIK' => 'Kddidik',
			'ESE' => 'Ese',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('ID',$this->ID);
		$criteria->compare('NIP',$this->NIP,true);
		$criteria->compare('NAMA',$this->NAMA,true);
		$criteria->compare('TGLAHIR',$this->TGLAHIR,true);
		$criteria->compare('SEX',$this->SEX,true);
		$criteria->compare('STAPEG',$this->STAPEG,true);
		$criteria->compare('KDUNIT',$this->KDUNIT,true);
		$criteria->compare('KDDEPT',$this->KDDEPT,true);
		$criteria->compare('KDDEPT1',$this->KDDEPT1,true);
		$criteria->compare('GOL',$this->GOL,true);
		$criteria->compare('TMTGOL',$this->TMTGOL,true);
		$criteria->compare('MKGTH',$this->MKGTH);
		$criteria->compare('MKGBL',$this->MKGBL);
		$criteria->compare('ISTRI',$this->ISTRI);
		$criteria->compare('ANAK',$this->ANAK);
		$criteria->compare('KDDIDIK',$this->KDDIDIK,true);
		$criteria->compare('ESE',$this->ESE,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}